package com.classroom.smart.service;

import com.classroom.smart.mapper.ManagerMapper;
import com.classroom.smart.pojo.Manager;
import com.classroom.smart.pojo.ManagerExample;
import com.classroom.smart.vo.LoginVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ManagerService {

    @Autowired
    private ManagerMapper managerMapper;

    public Manager login(LoginVO vo){
        ManagerExample managerExample = new ManagerExample();
        managerExample.createCriteria().andNameEqualTo(vo.getUsername()).andPasswordEqualTo(vo.getPassword());
        List<Manager> managers = managerMapper.selectByExample(managerExample);
        return managers.get(0);
    }

}
